package com.three.crm.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.three.crm.R;
import com.three.crm.bean.CommonBean;

import java.util.List;

public class GoodSelectAdapter extends BaseQuickAdapter<CommonBean, BaseViewHolder> {

    private String type = "";

    public void setType(String type) {
        this.type = type;
    }

    public GoodSelectAdapter(@Nullable List<CommonBean> data) {
        super(R.layout.item_list_select_goods,data);
    }

    public GoodSelectAdapter() {
        super(R.layout.item_list_select_goods);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, CommonBean item) {
        helper.setText(R.id.tv_price, item.getPrice())
                .setText(R.id.tv_goods_name, "" + item.getGoods_name())
                .setText(R.id.tv_goods_num, "" + item.getGoods_num() + item.getGoods_unit())
                .setText(R.id.tv_total, "" + item.getMoney())
                .setText(R.id.tv_time, "" + item.getCtime())
                .setText(R.id.tv_car_time, "" + item.getCar_time())
                .setGone(R.id.tv_select,type.equals("select"))
                .addOnClickListener(R.id.tv_detail,R.id.tv_edit,R.id.tv_select);
    }
}
